package com.xxgc.vfc.aop.common;

import cn.hutool.extra.spring.SpringUtil;
import com.xxgc.vfc.aop.po.SystemInfoPO;
import com.xxgc.vfc.api.result.Result;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Author: SJY
 * @Date :2023/10/24 - 10 - 24 - 17:09
 * 系统信息接口统一返回
 */
@Aspect
@Component
public class SystemInfoResultAOP {

    @Autowired
    private SystemInfoPO systemInfoPO;

    @Around("execution (* com.xxgc.vfc.modules.consumer.*.controller.*Controller.*(..))")
    public Object userIdCard(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {

        Result result = (Result) proceedingJoinPoint.proceed();

        result.systemName(systemInfoPO.getSystemName()).systemVersion(systemInfoPO.getSystemVersion());

        return result;
    }

}
